OpenStack Mitaka : Start VM-Instance
2016/04/20 |
Create and Start Virtual Machine Instance.
|
|
[1] | Specify the flavor (memory or disk) and create an instance and boot it. |
# default flavor list root@dlp ~(keystone)# nova flavor-list +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ | 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True | | 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | | 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | | 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | | 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | +----+-----------+-----------+------+-----------+------+-------+-------------+-----------+ # show the list of images root@dlp ~(keystone)# nova image-list +--------------------------------------+------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+------------+--------+--------+ | 8d0ae5ab-b725-44d6-a2bb-e0748c9c3558 | Ubuntu1404 | ACTIVE | | +--------------------------------------+------------+--------+--------+ # create and boot an instance root@dlp ~(keystone)# nova boot --flavor 2 --image Ubuntu1404 --security-groups default Ubuntu_1404 +--------------------------------------+---------------------------------------------------+ | Property | Value | +--------------------------------------+---------------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-SRV-ATTR:host | - | | OS-EXT-SRV-ATTR:hypervisor_hostname | - | | OS-EXT-SRV-ATTR:instance_name | instance-00000001 | | OS-EXT-STS:power_state | 0 | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | - | | OS-SRV-USG:terminated_at | - | | accessIPv4 | | | accessIPv6 | | | adminPass | NsqhJTP8aPJx | | config_drive | | | created | 2016-04-20T14:04:51Z | | flavor | m1.small (2) | | hostId | | | id | c6703a8b-f080-4964-80a9-01d35d3e7061 | | image | Ubuntu1404 (8d0ae5ab-b725-44d6-a2bb-e0748c9c3558) | | key_name | - | | metadata | {} | | name | Ubuntu_1404 | | os-extended-volumes:volumes_attached | [] | | progress | 0 | | security_groups | default | | status | BUILD | | tenant_id | 96d1d53558954be8a4bcf88bece93254 | | updated | 2016-04-20T14:04:51Z | | user_id | 1628f9bf8ce3434cab4a2a4870c85566 | +--------------------------------------+---------------------------------------------------+ # how status root@dlp ~(keystone)# nova list +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | BUILD | spawning | NOSTATE | network01=10.1.0.2 | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ |
[2] | Login to the Instance just booted. |
# after few minutes later, the Status turns "ACTIVE" like follows root@dlp ~(keystone)# nova list +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | ACTIVE | - | Running | network01=10.1.0.2 | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ # it's OK if ICMP answer replys like follows root@dlp ~(keystone)# ping 10.1.0.2 64 bytes from 10.1.0.2: icmp_seq=1 ttl=64 time=0.301 ms 64 bytes from 10.1.0.2: icmp_seq=2 ttl=64 time=0.232 ms --- 10.1.0.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.232/0.266/0.301/0.038 ms # login with SSH root@dlp ~(keystone)# ssh ubuntu@10.1.0.2
The authenticity of host '10.1.0.2 (10.1.0.2)' can't be established.
ECDSA key fingerprint is 9e:7d:63:ad:c8:96:67:f3:0f:f3:bc:fc:62:81:08:63.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.1.0.2' (ECDSA) to the list of known hosts.
ubuntu@10.1.0.2's password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-85-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Wed Apr 20 22:06:17 2016
trusty@ubuntu-1404:~$  # just logined |
[3] | If you'd like to stop an instance, it's also possible to control with nova command like follows. |
root@dlp ~(keystone)# nova list +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | ACTIVE | - | Running | network01=10.1.0.2 | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ # stop instance root@dlp ~(keystone)# nova stop Ubuntu_1404 Request to stop server Ubuntu_1404 has been accepted. root@dlp ~(keystone)# nova list +--------------------------------------+-------------+---------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+---------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | SHUTOFF | - | Shutdown | network01=10.1.0.2 | +--------------------------------------+-------------+---------+------------+-------------+--------------------+ # start instance root@dlp ~(keystone)# nova start Ubuntu_1404 Request to start server Ubuntu_1404 has been accepted. root@dlp ~(keystone)# nova list +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | ACTIVE | - | Running | network01=10.1.0.2 | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ |
[4] | It's possible to access with Web browser to get VNC console. |
root@dlp ~(keystone)# nova list +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-------------+--------+------------+-------------+--------------------+ | c6703a8b-f080-4964-80a9-01d35d3e7061 | Ubuntu_1404 | ACTIVE | - | Running | network01=10.1.0.2 | +--------------------------------------+-------------+--------+------------+-------------+--------------------+root@dlp ~(keystone)# nova get-vnc-console Ubuntu_1404 novnc +-------+--------------------------------------------------------------------------------+ | Type | Url | +-------+--------------------------------------------------------------------------------+ | novnc | http://10.0.0.30:6080/vnc_auto.html?token=c91800b6-d480-4079-8cc3-74fb0b0041e6 | +-------+--------------------------------------------------------------------------------+ |
[5] | Access to the URL which was displayed by "get-vnc-console" like follows. |